<!--设置HisCode -->
<template>
	<div class="mcTableIndex">
		<div style="margin-bottom: 10px">
			<el-input
				v-model="name"
				placeholder="请输入姓名或字母缩写"
				size="mini"
				style="width: 140px; margin-right: 10px"
			></el-input>
			<el-select
				v-model="sex"
				clearable
				size="mini"
				style="width: 120px; margin-right: 10px"
			>
				<el-option
					:value="item.value"
					:label="item.label"
					v-for="(item, index) in sexList"
					v-bind:key="index"
				></el-option>
			</el-select>
			<!-- <el-select
				v-model="status"
				size="mini"
				style="width: 120px; margin-right: 10px"
			>
				<el-option value="1" label="状态1"></el-option>
				<el-option value="0" label="状态2"></el-option>
			</el-select> -->
			<custom-button
				type="search"
				style="margin-right: 10px"
				@searchClick="searchClick"
			></custom-button>
			<custom-button
				type="reset"
				style="margin-right: 10px"
				@resetClick="resetClick"
			></custom-button>
			<custom-button
				type="add"
				title="保存"
				@addClick="saveClick"
			></custom-button>
		</div>
		<div class="mcTableList">
			<el-table
				:data="dataSource"
				border
				style="width: 100%; height: 500px"
				ref="table"
				:row-style="{ height: '40px' }"
				:cell-style="{ padding: '0' }"
			>
				<el-table-column
					prop="examineeCode"
					label="受试者编码"
					width="120"
					align="center"
				>
				</el-table-column>
				<el-table-column
					prop="filterNo"
					label="筛选号"
					width="120"
					align="center"
				>
				</el-table-column>
				<el-table-column
					prop="examineeName"
					label="姓名"
					width="120"
					align="center"
				>
				</el-table-column>
				<el-table-column
					prop="examineeEn"
					label="姓名缩写"
					width="110"
					align="center"
				>
				</el-table-column>
				<el-table-column prop="sex" label="性别" width="80" align="center">
					<template slot-scope="scope">
						<slot :name="scope.row.sex" :params="scope.row">
							{{ getSexLabel(scope.row.sex) }}
						</slot>
					</template>
				</el-table-column>
				<el-table-column
					prop="hisNo"
					label="His系统编号"
					width="120"
					align="center"
				>
					<template slot-scope="scope">
						<slot :name="scope.row.hisNo" :params="scope.row">
							<el-input size="mini" v-model="scope.row.hisNo"></el-input>
						</slot>
					</template>
				</el-table-column>
			</el-table>
		</div>
	</div>
</template>

<script>
	import customButton from "@/components/customComponents/customForm/customButton"
	import { AjaxCommon } from "@/libs/apiCommon"
	import { PopupCommon } from "@/libs/popupCommon"
	import { Utility } from "@/libs/utility"
	export default {
		components: { customButton },
		data() {
			return {
				status: "",
				name: "",
				sex: "",
				dataSource: [],
				sexList: Utility.getDictList("sex"),
			}
		},
		methods: {
			getSexLabel(value) {
				return this.sexList.find((t) => t.value == value).label
			},
			searchClick() {
				// this.pageNo = 1
				// this.initPage()
			},
			resetClick() {
				this.status = ""
				this.name = ""
				this.sex = ""
			},
			saveClick() {
				PopupCommon.confirm("确定保存？")
					.then(() => {
						PopupCommon.message("info", "调用修改接口")
					})
					.catch(() => {
						console.log("取消")
					})
			},
			getData() {
				let self = this
				AjaxCommon("/ccdc/pm/em/filter/emFilterExaminee/listByPage", "post", {
					// name: this.name,
					// status: this.status,
					// sex:this.sex,
					// pageNo: this.pageNo,
					// pageSize: this.pageSize
				}).then((res) => {
					if (res.data.code == 200) {
						self.dataSource = res.data.result.records
					} else {
						PopupCommon.notify("error", res.data.message)
					}
				})
			},
		},
		mounted() {
			this.getData()
		},
	}
</script>

<style scoped>
	.mcTableIndex {
		margin-top: 0;
	}

	.mcTableIndex .mcTableList {
		overflow: hidden;
	}
</style>
